﻿using System;
using System.Collections.Generic;
using System.Net;
using System.Text;

namespace dnsServerCSharp
{
    public class ARecordTable
    {
        public void remove(string name)
        {
            records.Remove(name);
        }
        public void insert(string name, string ipv4Address)
        {
            name.Replace('@', '.');
            records.Add(name, DnsAData.fromData(IPAddress.Parse(ipv4Address).GetAddressBytes()));
        }
        public bool has(string name)
        {
            return records.ContainsKey(name);
        }

        public DnsAData at(string name)
        {
            return records[name];
        }

        public long size
        {
            get
            {
                return records.Count;
            }
        }
        Dictionary<string, DnsAData> records = new Dictionary<string, DnsAData>();
    }
}
